# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ProximityBeacon.V1beta1.Model.BeaconAttachment do
  @moduledoc """
  Project-specific data associated with a beacon.

  ## Attributes

  *   `attachmentName` (*type:* `String.t`, *default:* `nil`) - Resource name of this attachment. Attachment names have the format:
      <code>beacons/<var>beacon_id</var>/attachments/<var>attachment_id</var></code>.
      Leave this empty on creation.
  *   `creationTimeMs` (*type:* `DateTime.t`, *default:* `nil`) - The UTC time when this attachment was created, in milliseconds since the
      UNIX epoch.
  *   `data` (*type:* `String.t`, *default:* `nil`) - An opaque data container for client-provided data. Must be
      [base64](http://tools.ietf.org/html/rfc4648#section-4) encoded in HTTP
      requests, and will be so encoded (with padding) in responses.
      Required.
  *   `maxDistanceMeters` (*type:* `float()`, *default:* `nil`) - The distance away from the beacon at which this attachment should be
      delivered to a mobile app.

      Setting this to a value greater than zero indicates that the app should
      behave as if the beacon is "seen" when the mobile device is less than this
      distance away from the beacon.

      Different attachments on the same beacon can have different max distances.

      Note that even though this value is expressed with fractional meter
      precision, real-world behavior is likley to be much less precise than one
      meter, due to the nature of current Bluetooth radio technology.

      Optional. When not set or zero, the attachment should be delivered at the
      beacon's outer limit of detection.

      Negative values are invalid and return an error.
  *   `namespacedType` (*type:* `String.t`, *default:* `nil`) - Specifies what kind of attachment this is. Tells a client how to
      interpret the `data` field. Format is <var>namespace/type</var>. Namespace
      provides type separation between clients. Type describes the type of
      `data`, for use by the client when parsing the `data` field.
      Required.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :attachmentName => String.t(),
          :creationTimeMs => DateTime.t(),
          :data => String.t(),
          :maxDistanceMeters => float(),
          :namespacedType => String.t()
        }

  field(:attachmentName)
  field(:creationTimeMs, as: DateTime)
  field(:data)
  field(:maxDistanceMeters)
  field(:namespacedType)
end

defimpl Poison.Decoder, for: GoogleApi.ProximityBeacon.V1beta1.Model.BeaconAttachment do
  def decode(value, options) do
    GoogleApi.ProximityBeacon.V1beta1.Model.BeaconAttachment.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ProximityBeacon.V1beta1.Model.BeaconAttachment do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
